//
//  DSDrawingViewController.m
//  Note
//
//  Created by DongSen on 2018/9/11.
//  Copyright © 2018年 董森森. All rights reserved.
//
#define kSTATUSBARHEIGGT ((([UIApplication sharedApplication].statusBarFrame.size.height==40||[UIApplication sharedApplication].statusBarFrame.size.height==64)?([UIApplication sharedApplication].statusBarFrame.size.height-20):[UIApplication sharedApplication].statusBarFrame.size.height))
#define kNAVIGATIONTITLEHEIGHT 44
#define kNAVIGATIONBARHEIGHT ((kNAVIGATIONTITLEHEIGHT)+(kSTATUSBARHEIGGT))
#define kSCREEN_W [UIScreen mainScreen].bounds.size.width
#define kSCREEN_H [UIScreen mainScreen].bounds.size.height

#import "DSScanvasView.h"
#import "DSDrawingViewController.h"
@interface DSDrawingViewController ()
@property (weak, nonatomic) IBOutlet UIScrollView *scrollerView;
@property(nonatomic,strong)DSScanvasView * sacanView;
@end

@implementation DSDrawingViewController

- (DSScanvasView *)sacanView{
    if (!_sacanView){
        _sacanView = [[DSScanvasView alloc] init];
        _sacanView.frame = CGRectMake(0, kNAVIGATIONBARHEIGHT, kSCREEN_W, kSCREEN_H-kNAVIGATIONBARHEIGHT);
        [self.scrollerView addSubview:_sacanView];
    }
    return _sacanView;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"画板";
    self.sacanView.backgroundColor = [UIColor whiteColor];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"保存" style:UIBarButtonItemStyleDone target:self action:@selector(save)];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"上一条" style:UIBarButtonItemStyleDone target:self action:@selector(back)];
    UIGestureRecognizer * tap = [[UIGestureRecognizer alloc] initWithTarget:self action:@selector(selectColor)];
    [self.navigationItem.titleView addGestureRecognizer:tap];
    // Do any additional setup after loading the view from its nib.
}
- (void)selectColor{
    
}
- (void)save{
    NSLog(@"%@",self.sacanView.paths);
    for (NSDictionary * dic  in self.sacanView.paths) {
        UIBezierPath * path = [dic valueForKey:@"Path"];
        NSLog(@"%@",path);
    }

}
- (void)back{
    [self.sacanView back];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
